const hre = require("hardhat");

async function main() {
  // Deploy Verifier contract
  const Verifier = await hre.ethers.getContractFactory("Verifier");
  const verifier = await Verifier.deploy();
  await verifier.deployed();
  console.log("Verifier deployed to:", verifier.address);

  // Deploy FinZkTrust contract
  const FinZkTrust = await hre.ethers.getContractFactory("FinZkTrust");
  const finZkTrust = await FinZkTrust.deploy();
  await finZkTrust.deployed();
  console.log("FinZkTrust deployed to:", finZkTrust.address);

  // Save contract addresses to a file
  const fs = require("fs");
  const contracts = {
    verifier: verifier.address,
    finZkTrust: finZkTrust.address,
  };
  fs.writeFileSync(
    "contract-addresses.json",
    JSON.stringify(contracts, null, 2)
  );
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  }); 